# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=kitinerary
pkgver=24.02.2
pkgrel=0
# armhf blocked by qt6-qtdeclarative
# ppc64le FTBFS
arch="all !armhf !ppc64le"
url="https://kontact.kde.org/"
pkgdesc="Data model and extraction system for travel reservation information"
license="LGPL-2.0-or-later"
depends_dev="
	kcalendarcore-dev
	kcontacts-dev
	kmime-dev
	kpkpass-dev
	libphonenumber-dev
	zxing-cpp-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	ki18n-dev
	libxml2-dev
	poppler-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	samurai
	shared-mime-info
	zlib-dev
	"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/pim/kitinerary.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kitinerary-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# skipped tests are broken
	local skipped_tests="("
	local tests="
		datatypes
		jsonlddocument
		mergeutil
		knowledgedb
		airportdb
		extractorscriptengine
		pkpassextractor
		postprocessor
		calendarhandler
		extractor
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)test"
	ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
29b2db03b24594f4d96fbb1cf6fd60bfef7015b25fc5e33d1275904af6be9abcd622895dd425e6875ca4b609340ca575e7f2a34f3054d147f95242e1fc61ba46  kitinerary-24.02.2.tar.xz
"
